package com.integral.xr.module.platform.dal.mysql.activity;

import java.util.*;

import com.integral.xr.framework.common.pojo.PageResult;
import com.integral.xr.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.integral.xr.framework.mybatis.core.mapper.BaseMapperX;
import com.integral.xr.module.platform.dal.dataobject.activity.ActivityDO;
import org.apache.ibatis.annotations.Mapper;
import com.integral.xr.module.platform.controller.admin.activity.vo.*;

/**
 * 村镇活动 Mapper
 *
 * @author 积分系统
 */
@Mapper
public interface ActivityMapper extends BaseMapperX<ActivityDO> {

    default PageResult<ActivityDO> selectPage(ActivityPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ActivityDO>()
                .likeIfPresent(ActivityDO::getActivityName, reqVO.getActivityName())
                .eqIfPresent(ActivityDO::getActivityContent, reqVO.getActivityContent())
                .betweenIfPresent(ActivityDO::getActivityTime, reqVO.getActivityTime())
                .eqIfPresent(ActivityDO::getActivityAddress, reqVO.getActivityAddress())
                .eqIfPresent(ActivityDO::getAcquirePoints, reqVO.getAcquirePoints())
                .eqIfPresent(ActivityDO::getContactPhone, reqVO.getContactPhone())
                .eqIfPresent(ActivityDO::getContactPerson, reqVO.getContactPerson())
                .eqIfPresent(ActivityDO::getState, reqVO.getState())
                .betweenIfPresent(ActivityDO::getStopTime, reqVO.getStopTime())
                .eqIfPresent(ActivityDO::getRejectReason, reqVO.getRejectReason())
                .betweenIfPresent(ActivityDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ActivityDO::getId));
    }

}